<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<link href="images/reset.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
<link href="images/system.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" /> 
<link href="images/table_form.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
<link href="{yun:}$config.sy_weburl{/yun}/js/layui/css/layui.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />

<script src="{yun:}$config.sy_weburl{/yun}/js/jquery-1.8.0.min.js?v={yun:}$config.cachecode{/yun}"></script>
<script src="{yun:}$config.sy_weburl{/yun}/js/layui/layui.js?v={yun:}$config.cachecode{/yun}"></script>
<script src="{yun:}$config.sy_weburl{/yun}/js/layui/phpyun_layer.js?v={yun:}$config.cachecode{/yun}"></script>
<script src="js/admin_public.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
<script src="js/icheck.js?v={yun:}$config.cachecode{/yun}"></script>
<script language="javascript">

function CheckMember(){  

	var username=$("#username").val();
	if(username==''){
		layer.msg('用户名不能为空！', 2, 8);return false;
	} 
	if($("input[name='password']").val()==''){
		layer.msg('密码不能为空！', 2, 8);return false;
	}
	var linkman=$("#linkman").val();
	if(linkman==''){
		layer.msg('联系人不能为空！', 2, 8);return false;
	}
	var obj = $("input[name='email']").val();
	var myreg = /^([a-zA-Z0-9\-]+[_|\_|\.]?)*[a-zA-Z0-9\-]+@([a-zA-Z0-9\-]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
	if(obj!=""&&!myreg.test(obj)){
		layer.msg('联系邮箱格式错误！', 2, 8);return false;
	}
	if($("input[name='moblie']").val() ==''){
		layer.msg('联系手机不能为空！', 2, 8);return false;
	}else{
	   var obj = $("input[name='moblie']").val(); 
	   if(isjsMobile(obj)==false&&isjsTell(obj)==false){
	     layer.msg('电话格式错误！', 2, 8);return false;
	   }
	}
	if($("input[name='name']").val()==''){
		layer.msg('公司全称不能为空！', 2, 8);return false;
	}
	if($("input[name='address']").val()==''){
		layer.msg('公司地址不能为空！', 2, 8);return false;
	}
	loadlayer();
}

function checkUserName(){
	var username=$.trim($("#username").val());
	var pytoken=$.trim($("#pytoken").val());
	if(username){
		$.post("index.php?m=crm_customer&c=check",{username:username,pytoken:pytoken},function(msg){
			if(msg){
 				layer.tips('已存在该用户！',"#username" , {guide: 1,style: ['background-color:#F26C4F; color:#fff;top:-7px', '#F26C4F']});
				$("#username").attr("vtype",'1');
			}else if($("#username").attr('vtype')=='1'){
				layer.closeTips();
				$("#username").attr("vtype",'0');
			}
		});
	}
}
</script> 
<title>后台管理</title>
</head>

<body class="body_ifm">
<div class="infoboxp">
	<div class="admin_new_tip">
		<div class="admin_new_tit"><i class="admin_new_tit_icon"></i>操作提示</div>
		<div class="admin_new_tip_list_cont">
			<div class="admin_new_tip_list">该页面展示了业务员添加客户信息。</div>
		</div>
	</div>

	<div class="clear"></div>

	<div class="admin_add_box">
		<div class="admin_add_box_c">

		<iframe id="supportiframe"  name="supportiframe" onload="returnmessage('supportiframe');" style="display:none"></iframe> 
		
		<form name="myform" {yun:}if $get_info.type==''{/yun}target="supportiframe"{yun:}/if{/yun}  action="index.php?m=crm_customer&c=add" onSubmit="return CheckMember();" method="post" class="layui-form">
			
			<!-- 
				<div class="admin_add_list">
					<div class="admin_add_list_name"><span class="admin_required_icon">*</span> 会员级别</div>
					<div class="admin_add_list_right">
						<div class="">
							<div class="layui-input-block">
								<div class="layui-input-inline">
									<select name="rating_name" id="rating_name" lay-verify="rating_name" >
										<option value="">请选择</option>
										{yun:}foreach from=$rating_list item=v{/yun}
											<option  value="{yun:}$v.id{/yun}">{yun:}$v.name{/yun}</option>
										{yun:}/foreach{/yun}
									</select>
								</div>
							</div>
						</div>
					</div>
				</div>
			-->

			<div class="admin_add_list">
				<div class="admin_add_list_name"><span class="admin_required_icon">*</span> 用户名</div>
				<div class="admin_add_list_right">
					<input type="text"  value="" name="username" class="input-text"  onblur="checkUserName();" id="username">		
				</div>
			</div>

			<div class="admin_add_list">
				<div class="admin_add_list_name"><span class="admin_required_icon">*</span> 设置密码</div>
				<div class="admin_add_list_right">
					<input type="password" value="" name="password" class="input-text" />
					<font color="gray"></font>
				</div>
			</div>

			<div class="admin_add_list">
				<div class="admin_add_list_name"><span class="admin_required_icon">*</span> 联系人</div>
				<div class="admin_add_list_right">
					<input type="text"  value="" name="linkman" class="input-text" id="linkman">		
				</div>
			</div>

			<div class="admin_add_list">
				<div class="admin_add_list_name"><span class="admin_required_icon">*</span> 联系手机</div>
				<div class="admin_add_list_right">
					<input type="text" value="" name="moblie" class="input-text" >
					<font color="gray"></font>
 				</div>
			</div>

			<div class="admin_add_list">
				<div class="admin_add_list_name"><span class="admin_required_icon"></span> 固定电话</div>
				<div class="admin_add_list_right">
					<input type="text"  id="areacode" name="areacode" class="input-text" placeholder="如：0527" maxlength="7" style="width:70px;"/>
					<input type="text"  placeholder="固定电话" id="telphone" class="input-text" name='telphone' maxlength="8"style="width:150px;"/>
					<input type="text"  placeholder="分机号" id="exten" class="input-text" name='exten' maxlength="4"style="width:70px;"/>
					<font color="gray"></font>
				</div>
			</div>

			<div class="admin_add_list">
				<div class="admin_add_list_name"><span class="admin_required_icon"></span>联系邮箱</div>
				<div class="admin_add_list_right">
					<input type="text" value="" name="email" class="input-text" >
					<font color="gray"></font>
				</div>
			</div>

			<div class="admin_add_list">
				<div class="admin_add_list_name"><span class="admin_required_icon">*</span> 公司全称</div>
				<div class="admin_add_list_right">
					<input type="text" value="" name="name" class="layui-input" style="width:230px">
					<font color="gray"></font>
				</div>
			</div>

			<div class="admin_add_list">
				<div class="admin_add_list_name"><span class="admin_required_icon">*</span> 公司地址</div>
				<div class="admin_add_list_right">
					<input type="text" value="" name="address" class="layui-input" style="width:230px">
					<font color="gray"></font>
				</div>
			</div>

   			<div class="admin_add_list">
				<div class="admin_add_list_name">    
					<input type="hidden" id="status_1" name="status" value="1"> 
				</div>
			</div>

			<div class="admin_add_list">
				<input class="layui-btn layui-btn-normal" type="submit" name="submit" value="&nbsp;添 加&nbsp;" />
				<input class="admin_save_sub_qx" type="reset" name="reset" value="&nbsp;重 置 &nbsp;" />
			</div>

			<input type="hidden" name="pytoken" id="pytoken" value="{yun:}$pytoken{/yun}">
  		</form>

		</div>
	</div>
</div>

<script type="text/javascript">

layui.use(['layer', 'form'], function(){
	var form = layui.form,
		laydate = layui.laydate,
		$ = layui.$;
  });//end layui.use()

</script>
</body>
</html>